package com.demo.security;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * MD5加密
 *
 * @author lee9213@163.com
 * @version 1.0
 * @date 2017/3/17 11:27
 */
public class MD5Util {

    /**
     * MD5加密
     *
     * @param content
     * @return
     * @throws NoSuchAlgorithmException
     * @throws UnsupportedEncodingException
     */
    public static byte[] MD5(String content) throws NoSuchAlgorithmException, UnsupportedEncodingException {
        MessageDigest messageDigest = MessageDigest.getInstance("MD5");
        byte[] bytes = messageDigest.digest(content.getBytes("utf8"));
        return bytes;
    }
}
